import { defineConfig } from "vite";
import uni from "@dcloudio/vite-plugin-uni";
import AutoImport from 'unplugin-auto-import/vite'
export default defineConfig({
  plugins: [uni(),
    AutoImport({
      imports: [
        'vue',
        'uni-app'
      ],
      dirs: [
        'src/utils',
        'src/wxs/**'
      ],
      dts: 'src/auto-imports.d.ts',
      eslintrc: {
        enabled: true
      }
    }),
  ],
  
  optimizeDeps: {
    // include: ["@dcloudio/uni-ui"],
  },
  server: {
    cors: true,
    open: true,
    host: '0.0.0.0',
    port: 8991,
    proxy: {
      '/v1/api': {
          target: 'http://127.0.0.1:8086',   //代理接口
          changeOrigin: true,
          rewrite: (path) => path.replace(/^\/api/, 'api')
      },
      '/asxsyd92upload': {
        target: 'http://asxsyd92.com',   //代理接口
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, 'api')
    }
    }
}
});